package com.minimalist.common.entity.basic.vo.tenant;

import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import java.io.Serial;
import java.io.Serializable;

@Schema(name = "租户数据源实体")
public class TenantDatasourceVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    @NotBlank(message = "数据源名称不能为空", groups = {Add.class, Update.class})
    @Schema(name = "datasourceName", description = "数据源连接", type = "string")
    private String datasourceName;

    @NotBlank(message = "数据源连接不能为空", groups = {Add.class, Update.class})
    @Schema(name = "datasourceUrl", description = "数据源连接", type = "string")
    private String datasourceUrl;

    @NotBlank(message = "数据源用户名不能为空", groups = {Add.class, Update.class})
    @Schema(name = "username", description = "数据源用户名", type = "string")
    private String username;

    @NotBlank(message = "数据源密码不能为空", groups = {Add.class, Update.class})
    @Schema(name = "password", description = "数据源密码", type = "string")
    private String password;

    public String getDatasourceName() {
        return datasourceName;
    }

    public void setDatasourceName(String datasourceName) {
        this.datasourceName = datasourceName;
    }

    public String getDatasourceUrl() {
        return datasourceUrl;
    }

    public void setDatasourceUrl(String datasourceUrl) {
        this.datasourceUrl = datasourceUrl;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TenantDatasourceVO that = (TenantDatasourceVO) o;
        return java.util.Objects.equals(datasourceName, that.datasourceName) &&
               java.util.Objects.equals(datasourceUrl, that.datasourceUrl) &&
               java.util.Objects.equals(username, that.username) &&
               java.util.Objects.equals(password, that.password);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(datasourceName, datasourceUrl, username, password);
    }

    @Override
    public String toString() {
        return "TenantDatasourceVO{" +
               "datasourceName='" + datasourceName + '\'' +
               ", datasourceUrl='" + datasourceUrl + '\'' +
               ", username='" + username + '\'' +
               ", password='" + password + '\'' +
               '}';
    }

}
